$ ->

  # Create the namespace if it doesn't exist
  $.quesse = $.quesse || {}


  # Remove empty/undefined strings in an Array
  Array.prototype.clean = ->
    for i in [0..this.length]
      if this[i] == '' || this[i] == null
        this.splice(i, 1)
        i--
    this


  # Log an event to the 'console'
  $.quesse.log = (message) ->
    $('.output').append('<div>' + message + '</div>')


  # Parse parameters
  $.quesse.parseParameters = ->
    raw_data = gadgets.views.getParams()['appData'] || ''

    raw_kvps = raw_data.split('*')
    raw_kvps = raw_kvps.clean()

    params = {}

    for raw_kvp in raw_kvps
      kvp = raw_kvp.split(':')
      params[kvp[0]] = kvp[1]

    params

